I'm having problems with a file that I've converted myself from VBscript to Jscript - using my rather simple algorithm "Chuck brackets round it". If someone could have a look at the two versions below and post any errors, I'd be very grateful.
VBscript version:
Option Explicit
Dim form, page, font
Dim oPDF
Dim InFileMapped
Dim lWidth, lHeight
Dim col1, col2
Dim buf
IMHO, dealing with fewer computer languages is always better. Especially if YOU are the maintenance programmer. I want to eventually address this same issue for the web site I have recently been assigned to maintain. With multiple languages, one is less likely to become a true master of any one. Why do you think some of these books on Web development technologies have 2, 4, even 8 (!) authors?
So far I've seen no compelling reason to use both VBScipt and JavaScript; but from a code management point of view, plenty of reason not to.
All the books one buys on ASP "teach" utilizing VBScript on the server side. Except for bending to the will of Microsoft, why do this? If I have to pay for all the training, books, tools, etc. necessary for using both languages in my coding shop you better have excellent reasons. So what are they; anyone?
Specifically, because this bit of VBscript I'm trying to convert has got to sit in amongst a HUGE page of Jscript. If someone tells me how to use two different server-side languages safely on the same page, passing variables between them and the rest of it, then I guess I don't have a problem - can anyone help me there? More generally, because I started off in Javascript, and know very little VB, so Jscript is a more comfortable language for me to write in.
<script language="VBScript" runat="server">
...
ASP has no problem running two languages on the same page... I haven't tried it SPECIFICALLY like above, but I use javascripts on VBScript pages, just because sometimes they are easier/shorter, when usually VBScript is easier.
I personally don't care if there is more than one scripting language on a page - as long as it works!!!
I found 2 small errors in your code, don't know if correcting them will fix it but here they are>
the comparision:
if(form = -1)
should be:
if(form == -1)
and the same goes a few lines later for the page variable
maybe this helps
Roelf
SH;
It's interesting that you define the variable in one language, and try to use it in another. I don't see how the Javascript compiler(?) can know about the results/object code/whatever of the VBScript compiler(?).
Maybe use a function to pass the value as a parameter?
If you don't believe me about the code I posted above, it's at:
http://www.solidscripts.com/languages.asp
...of course, all you'll see if you view the source is "Hello World!", though... ;)
whammy;
Oh, I think I see. RESPONSE is an ASP object, not a Javascript object. By completely surrounding the statement w/ the ASP tag, ASP will evaluate it, not Javascript.
I guess ASP objects simply have access to variables declared in VBScript and Javascript.
That's a good assumption (it seems to ring true to me, at any rate);
I didn't see any ASP tags surrounding the javascript or have a chance to test it though, since I usually only use javascript in functions on VBScript pages.
IMHO, dealing with fewer computer languages is always better. Especially if YOU are the maintenance programmer. I want to eventually address this same issue for the web site I have recently been assigned to maintain. With multiple languages, one is less likely to become a true master of any one. Why do you think some of these books on Web development technologies have 2, 4, even 8 (!) authors?
So far I've seen no compelling reason to use both VBScipt and JavaScript; but from a code management point of view, plenty of reason not to.
All the books one buys on ASP "teach" utilizing VBScript on the server side. Except for bending to the will of Microsoft, why do this? If I have to pay for all the training, books, tools, etc. necessary for using both languages in my coding shop you better have excellent reasons. So what are they; anyone?
One good reason I use mostly JScript in my server pages is that as a web developer I already know JavaScript. Client-side JavaScript is supported in browsers on many, many platforms so learning it is a good investment, while Basic and VBScript are mostly supported by Microsoft. How many web pages have you seen or even wrote that use client-side VB scripts ? And all books teach VBScript just to go with the flow given by Microsoft. But even the Script Developer guide from MSDN teaches both anyway ...
And then there is also the issue of each language having its advantages and disadvantages. JavaScript is more formal and technical for me, and as a C++ programmer I want that from the language I choose to script with.
Now I can work with both of them anyway. Even though you are right that I do not master any one of them, I think I should learn them both, and then if I want I can specialise into one.
Is this a record for the deepest thread-digging ever?? :D
Is this a record for the deepest thread-digging ever?? :D
I do not know, it might well be, as I did not look at the date when I replied. :thumbsup:
I found the thread yesterday.
I was searching for a way to create data of the COM (ActiveX) data type VT_ARRAY | VT_UI1 with JScript, as I want to output an Excel workbook from one of my web scripts, with Response.BinaryWrite, and BinaryWrite needs an object of that data type. Unfortunately JScript knows little about data types...
I did not even look at the year.
Anyway both VBScript and JScript are in use today, as ASP is, so the question is still up-to-date.